// CppSocketsException class
// The CppSocketsException class is the base class for all custom exception classes
// in CppSockets library.

#ifndef CPPSOCKETS_EXCEPTION_H
#define CPPSOCKETS_EXCEPTION_H

#include <string>

using namespace std;

class CppSocketsException
{
protected:
	
	static const int ERROR_NONE = 0;
	string description;
	int errorCode;

public:

	CppSocketsException(int errorCode=ERROR_NONE);

	CppSocketsException(const string & description, int errorCode=ERROR_NONE);
	
	CppSocketsException(const CppSocketsException & exception);

	// Sets the integer representing the error that caused this exception
	virtual void setErrorCode(int errorCode);
	
	// Sets a textual description for the error that caused this exception
	virtual void setDescription(const string & description);
	
	// Gets an integer representing the error that caused this exception
	virtual int getErrorCode() const;

	// Gets a textual description for the error that caused this exception
	virtual const string & getDescription() const;
};

#endif

